function verify_purchase_code($this){
    $($this).css('display','none');
    var purchase_code = $.trim($('#purchase_code').val());
    var purchase_email = $.trim($('#purchase_email').val());
    var cust_domain = $.trim($('#cust_domain').val());

    if( purchase_code != '' && purchase_email != '' && cust_domain != '' ) {
        var dataArr = {};
        dataArr [ 'purchase_code' ] = $('#purchase_code').val();
        dataArr [ 'purchase_email' ] = $('#purchase_email').val();
        dataArr [ 'cust_domain' ] = $('#cust_domain').val();

        $.post("https://pixelnx.com/verify_envato_purchase/themeportal_verification/themep.php",dataArr,function(data, status) {

            $($this).css('display','inline-block');
            var data = JSON.parse(data);
            if( data.value == '101' ) {
                // Succes
                $('#domaincheck').css('display','none');
                $('#reidrect').css('display','none');
                $('#errText').html('<span style="color:green;">Now Please complete installation process.</span>');
                document.cookie = "chkJS=yes;";
                $('#installerform').html(data.form);
                return false;
            }
            else if( data.value == '402' ) {
                 // Invalid Purchase Code
                $('#errText').html('<span style="color:red;">Purchase code is incorrect.</span>');
            }
            else if( data.value == '403' ) {
                // Invalid email
                $('#errText').html('<span style="color:red;">Email is incorrect.</span>');
            }
            $($this).css('display','inline-block');
            return false;
        });
    }
    else {
        $('#errText').html('<span style="color:red;">You missed out details.</span>');
        $($this).css('display','inline-block');
        return false;
    }
}
